<?php

namespace App\Http\Resources\Api\Admin;

use Illuminate\Http\Resources\Json\JsonResource;

class AdminRouteResource extends JsonResource
{
    public function toArray($request)
    {
        return [
            'route_id'=>$this->route_id,
            'name' => $this->name,
            'path' => $this->path,
            'hidden' => $this->hidden,
            'redirect' => $this->redirect,
            'always_show' => $this->always_show,
            'title' => $this->title,
            'icon' => $this->icon,
            'no_cache' => $this->no_cache,
            'affix' => $this->affix,
            'breadcrumb' => $this->breadcrumb,
            'roles' => AdminRouteRoleResource::collection($this->whenLoaded('roles')),
            'created_at'=>(string)$this->created_at,
            'updated_at'=>(string)$this->updated_at,
        ];
    }
}
